# !/bin/sh
# COPYRIGHT lipujun Equipment CO.,LTD
# file name: ip.sh
# function: This script is used to config IP
#
# author: lipujun

source /AIR_FLASH/system/air_sys.conf

#GE
if [ $local_GE1_mask == "" ] ; then
    ifconfig $GE1 $local_GE1_ip up
else
    ifconfig $GE1 $local_GE1_ip up netmask $local_GE1_mask
fi
if [ $local_GE2_mask == "" ] ; then
    ifconfig $GE2 $local_GE2_ip up
else  
    ifconfig $GE2 $local_GE2_ip up netmask $local_GE2_mask 
fi
if [ $local_GE3_mask == "" ] ; then
    ifconfig $GE3 $local_GE3_ip up
else
    ifconfig $GE3 $local_GE3_ip up netmask $local_GE3_mask
fi
if [ $local_GE4_mask == "" ] ; then
    ifconfig $GE4 $local_GE4_ip up
else
    ifconfig $GE4 $local_GE4_ip up netmask $local_GE4_mask
fi

#POE
ifconfig $bond_master down
ifconfig $bond_back down
if [ $Netbond_mask == "" ] ; then
    ifconfig $Netbond $air_local_ip up
else
    ifconfig $Netbond $air_local_ip up netmask $Netbond_mask 
fi

if [ "${Netbond}" == "bond0" ] ; then
    ifenslave $Netbond $bond_master $bond_back
fi

if [[ $gateway ]] && [[ $gateway != "" ]] ; then
    route add default gw $gateway netmask 0.0.0.0 dev $Netbond
fi
